package com.hruiworks.campusgroup.config;

import lombok.Data;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Data
@Configuration
@ConfigurationProperties(prefix = "oss-config")
public class OssConfig {

    private String endpoint;
    private String accessKeyId;
    private String accessKeySecret;
    private String bucketName;
    private String domain;

    // 静态变量
    @Getter
    private static OssConfig instance;

    // 在初始化时赋值
    @PostConstruct
    public void init() {
        // 便于后续进行访问
        this.domain = "https://" + bucketName + "." + endpoint ;
        instance = this;

    }

}
